<?php

declare(strict_types=1);

namespace app\model;

use app\model\Base;

/**
 * 角色管理
 */
class SysRole extends Base
{
    protected $pk = 'roleid';

    protected $schema = [
        "roleid" => "smallint",  // 
        "name" => "varchar",  // 用户组名
        "permissions" => "varchar",  // 权限id列表,以逗号隔开
        "remark" => "varchar",  // 备注
        "create_time" => "int",  // 
        "update_time" => "int",  // 
    ];

    public function getIdNameList()
    {
        return $this->column('id, name');
    }

    public function getpermissionIds($id)
    {
        return $this->where('id', $id)->value('permissions');
    }
}
